/*
 * @Author: sichuntian sichuntian@smartmappingtek.com
 * @Date: 2023-11-15 10:31:53
 * @LastEditors: sichuntian sichuntian@smartmappingtek.com
 * @LastEditTime: 2024-05-14 11:26:47
 * @Description:
 *
 */
const express = require("express");
const app = express();
const path = require("path");
const port = 8889;
const router = express.Router();
//解决跨域
const cors = require("cors");
app.use(cors());

const bodyParser = require("body-parser"); //用于req.body获取值的
app.use(bodyParser.json({ extended: false, limit: "50mb" }));

app.use(express.static(path.join(__dirname, "./dist")));
app.use(express.static(path.join(__dirname, "./static")));
app.use(express.static(path.join(__dirname, "./public")));

//连接数据库
const mongoose = require("mongoose");
const connectDB = require("./db/index");
connectDB.mongoose(mongoose);

//公共页面接口
const common = require("./app/routers/common/index");
app.use("/common", common);

app.listen(port, () => {
  console.log("启动");
});
